<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>

        // 1. ES6 的继承
        //   class constructor  extends  super  this 

        // 声明公共的类
        class Public {
            version = 'v1.0.0';
            constructor(n1, n2) {
                this.num = n1;
                this.price = n2;
            }
            total() {
                return this.num * this.price;
            }
        }

        // 声明子类
        class Goods extends Public {
            self_pro = '私有属性';
            constructor(name, n, p) {
                // 在继承的时候，子构造器中的第一句
                super(n, p);
                this.goodsName = name;
            }
        }

        const s1 = new Goods('导弹', 3, 108);
        console.log(s1);

    </script>
</body>

</html>